package com.xoa.plugin.workflow.workflowservice.imlp.lnsfplugin;

import com.xoa.dev.efficiency.model.FlowAbilityMonitor;
import com.xoa.model.users.Users;
import com.xoa.plugin.workflow.workflowservice.WorkFlowService;
import com.xoa.util.ToJson;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Major_3 implements WorkFlowService {
    @Override
    public ToJson run(HttpServletRequest request) {
        String runId=request.getParameter("runId");
        Users users=LnsfUtil.init().getUser(request);
        request.getParameter("runId");
        Map<String,Object> map=new HashMap<>();
        map.put("runId",runId);
        map.put("userId",users.getUserId());
        map.put("userType",5);
        List<FlowAbilityMonitor> abilityMonitorList=LnsfUtil.init().getFlowAbilityMonitorMapper().getFlowAbilityMonitorList(map);
        if(abilityMonitorList!=null&&abilityMonitorList.size()>0){
            for(int i=0;i<abilityMonitorList.size();i++){
                FlowAbilityMonitor flowAbilityMonitor=new FlowAbilityMonitor();
                flowAbilityMonitor.setRunId(Integer.parseInt(runId));
                flowAbilityMonitor.setUserId(users.getUserId());
                flowAbilityMonitor.setUserType(5);
                flowAbilityMonitor.setWorkEnd(LnsfUtil.init().getSdf().format(new Date()));
                LnsfUtil.init().setData(flowAbilityMonitor);
            }

        }
        return null;
    }
}
